;--------------------------------
; General Attributes

Name "AnimGif plug-in test"
OutFile "AnimGif.exe"
InstallDir "$PROGRAMFILES"


;--------------------------------
;Interface Settings

!include "MUI.nsh"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_RIGHT
; empty white placeholders for animated GIF
!define MUI_HEADERIMAGE_BITMAP emptyh.bmp
; this will be hidden
!define MUI_WELCOMEFINISHPAGE_BITMAP emptyw.bmp
!define MUI_PAGE_CUSTOMFUNCTION_PRE pre
!define MUI_PAGE_CUSTOMFUNCTION_SHOW show
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE leave
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_PAGE_CUSTOMFUNCTION_PRE pre
!define MUI_PAGE_CUSTOMFUNCTION_SHOW show
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE leave
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "English"

; for transparent images to be launched from 'show' function
!define COLOR_WINDOW 5
!define COLOR_BTNFACE 15 ; default for hidden windows - INSTFILES page color

Function pre

; hides control so we can draw on default target window
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 1" "Text" ""

Functionend

Function show

; for Back button - dll reset.
;  AnimGif::stop
; left logo on the Welcome page
  AnimGif::play /NOUNLOAD /HALIGN=LEFT /VALIGN=CENTER /BGCOL=${COLOR_WINDOW} "$EXEDIR\runrabbit.gif"

FunctionEnd

Function leave

  AnimGif::stop
; header image control
  GetDlgItem $0 $HWNDPARENT 1034
  AnimGif::play /NOUNLOAD /HWND=$0 /HALIGN=RIGHT /FIT=HEIGHT /BGCOL=${COLOR_WINDOW} "$EXEDIR\31m1.gif"
;  MessageBox MB_OK Returned

FunctionEnd


Function .onGUIEnd

  AnimGif::stop

FunctionEnd


Section


  Sleep 500
; during file install
  DetailPrint "Header logo"
;  Sleep 2000
  Sleep 2000
  DetailPrint "That's all"
  Sleep 500

SectionEnd